<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.wlcorp.forcazamis.domain.message.Message" %>
<%@page import="com.wlcorp.forcazamis.sys.util.SessionValue"%>
<%@ page import="com.wlcorp.forcazamis.sys.util.CommonUtil"%>
<%@ page import="com.wlcorp.forcazamis.sys.permission.PermissionManager" %>
<html>
<head>
	<title>消息中心</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/validator.js"></script>
	<script type="text/javascript">
		function goback(){
			window.location = "${pageContext.request.contextPath}/baseinfo/sampleTypeManager.do?method=getSampleTypeList";
		}
		function doSend(){
			if(document.forms["messageForm"].receiver.value.length < 1){
				alert("请选择消息接收人！");
				return;
			}
			if(document.forms["messageForm"].subject.value.length < 1){
				alert("你的标题将为空！");
			}
			document.forms["messageForm"].action="${pageContext.request.contextPath}/message/messageManager.do?method=sendMessage&operate=doSend";
			document.forms["messageForm"].submit();
		}
		function doDraft(){
			if(document.forms["messageForm"].receiver.value.length < 1){
				alert("请选择消息接收人！");
				return;
			}
			if(document.forms["messageForm"].subject.value.length < 1){
				alert("你的标题将为空！");
			}
			document.forms["messageForm"].action="${pageContext.request.contextPath}/message/messageManager.do?method=sendMessage&operate=doDraft";
			document.forms["messageForm"].submit();
		}
		
		function selectStaff(){
			var returnValue = window.showModalDialog("${pageContext.request.contextPath}/system/staffManager.do?method=selectStaffTop"
				,window,"dialogHeight:480px;dialogWidth:580px;center:yes;help:no;resizable:no;status:no;");

			var staffId="";
			var staffName="";
			if(returnValue && null != returnValue){
				for(i = 0;i < returnValue.length;i++){
					staffId+=returnValue[i]["staffId"]+"#";
					staffName+=returnValue[i]["staffName"]+";";
				}
				document.forms["messageForm"].receiverId.value = staffId;
				document.forms["messageForm"].receiver.value = staffName;
			}
		}
	</script>
</head>
<body>
<form name="messageForm" method="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="981">撰写消息</td>
	</tr>
</table>
<center>
<table width="90%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
  <tr> 
    <td colspan="4" class="table_unfold_titlebar_small_bg">&nbsp;&nbsp;<b>消息详细</b></td>
  </tr>
  <tr class="InputFrameLine">
        <td width="4%" class="table_label" id="sampleTypeName_TEXT">接收人</td>
		<td width="50%">&nbsp;
	    	<input class="input" type="text" name="receiver" value="" size="100" maxlength="100" readonly/>
	    	<input class="input" type="hidden" name="receiverId" value="" size="100" maxlength="100" readonly/></td>
		<td width="12%" class="table_label" id="sampleTypeCode_TEXT"><input name="button" type="button" onClick="selectStaff()" value="选择收件人"></td>
		<td width="34%">&nbsp;
			<input type="radio" name="type" value="0" />&nbsp;一般<input type="radio" name="type" value="1" />&nbsp;紧急
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="memo_TEXT">标题</td>
		<td colspan="3">&nbsp;
		<input class="input" type="text" name="subject" value="" size="100" maxlength="500"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="memo_TEXT">内容</td>
		<td colspan="3">&nbsp;
		<textarea id="memo" name="content" cols="150" rows="20"></textarea></td>
  </tr>
  <tr class="InputFrameLine">
  	<td align="center" colspan="4">
  		<input type="button" class="button_save" name="draft_button" value="     草稿" onClick="javascript:doDraft()">
  		<input type="button" class="button_common" name="send_button" value="立即发送" onClick="javascript:doSend()">
  		<input type="button" class="button_common_3" name="goback_button" value="返回" onclick="javascript:history.go(-1)" class="button_save">
  	</td>
  </tr>
</table>
</center>
 <%out.print(PermissionManager.getInstance().checkSubPermission("6005",request));%>
  ${message}
</form>
</body>
</html>
